<template>
    <section id="k8s-configmaps">
        <el-card style="margin-bottom: 20px" class="bg-card">
            <div>详情</div>
            <hr>
            <div style="margin-bottom: 5px">名称：{{ConfigmapDetail.configMap.name}}</div>
            <div style="margin-bottom: 5px">命名空间：{{ConfigmapDetail.configMap.namespace}}</div>

            <div style="margin-bottom: 5px">标签：
                <div v-if="ConfigmapDetail.configMap.labels !== null">
                <el-tag size="mini" v-for="(v,key) in ConfigmapDetail.configMap.labels "> {{key}}: {{v}}</el-tag>
                </div>
                <span v-else>--</span>
            </div>

            <div style="margin-bottom: 5px">创建时间：{{ConfigmapDetail.configMap.createdate}}</div>



        </el-card>

        <el-card style="margin-bottom: 20px" class="bg-card">
            <div>数据</div>
            <hr>
            <div v-for="(v,key) in ConfigmapDetail.configMap.data " style="margin-bottom: 5px">
                <span style="font-weight: 600">{{key}}:&nbsp;&nbsp;</span><span>{{v}}</span>

            </div>


        </el-card>


    </section>
</template>

<script>
    import { k8sConfigmapData } from '../../api/api'
    export default {
        data() {
            return {
                ConfigmapDetail: {
                    configMap:{},

                },
            }
        },
        methods: {

            getK8sConfigmapDetailData(){
                let self = this
                let param = {name:this.$route.params.name,namespace:this.$route.query.namespace}
                k8sConfigmapData(param).then((res) => {
                    console.log(res)
                    self.ConfigmapDetail.configMap = res.configMap




                })

            },
            rowStyle({ row, rowIndex}){
                return "height:40px;"
            },
            headerStyle({ row, rowIndex}){
                return "height:20px;color:#0099FF;"
            },

        },
        mounted: function () {
            console.log(this.$route.params.name)
            console.log(this.$route.query.namespace)
            this.getK8sConfigmapDetailData()
        }
    }
</script>
<style>
    #k8s-configmaps .bg-card {
        background-color: #FAFAFA;
    }
</style>